package com.itboye.ihomebank.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.base.MyApplcation;
import com.itboye.ihomebank.bean.WoDeFangYuanBean;
import com.itboye.ihomebank.constants.NetPublicConstant;
import com.itboye.ihomebank.support.commonadapter.MutiplyCommonAdapter;
import com.itboye.ihomebank.support.commonadapter.ViewHolder;
import com.itboye.ihomebank.util.XImageLoader;
/**
 * 我发布的房源
 *
 */
public class MyFaBuAdapter02 extends MutiplyCommonAdapter<WoDeFangYuanBean>{

	public MyFaBuAdapter02(Context context, List<WoDeFangYuanBean> datas, int... layoutId) {
		super(context, datas, layoutId);
		// TODO Auto-generated constructor stub
	}

	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void getItemPosition(int position) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void convert(ViewHolder holder, WoDeFangYuanBean t, int type,
			int position) {
		holder.setText(R.id.fangyuan_title, t.getTitle());
		holder.setText(R.id.fangyuan_addr, t.getAddressDetail());
		holder.setText(R.id.fangyuan_money, t.getRent()+"元/月");
		XImageLoader.load(NetPublicConstant.IMAGE_URL + t.getImgId(),
				(ImageView) holder.getView(R.id.fangyuan_img));
		
		
		String biao01=t.getTags();
		String[] str = {};
		if(biao01!=null){
			str = biao01.split(",");
		}
		holder.removeAllViews(R.id.fabu_flowLayout02);
		for (int i = 0; i < str.length; i++) {
			View view = LayoutInflater.from(MyApplcation.ctx).inflate(
					R.layout.item_biaoqian, null);
			final TextView btn_name = (TextView) view
					.findViewById(R.id.btn_name);
			btn_name.setText(str[i]);
			
			holder.addView(R.id.fabu_flowLayout02, view);
		}
		
	}

}
